
/**
 * created on 2012-03-21
 * @author  qiujz
 * @version 1.0
 *
 * Copyright (c)  Founder Software (Suzhou) Co., Ltd.  2012
 *  All rights reserved.
 *
 * 
 * ================================================================
 * Change Revision
 * ---------------------------------------------------------------
 *    DATE                BY                   COMMENT
 * ---------------------------------------------------------------
 * 2012-03-21         qiujz                Create class
 * 
 *
 * ================================================================
 */	

package com.founder.bm.dao.impl;

import java.sql.SQLException;
import java.util.List;
import java.util.Map;

import com.ibatis.sqlmap.client.SqlMapClient;
import com.founder.mh.framework.dao.impl.BaseDaoImpl;
import com.founder.bm.dao.IEnrollInfDao;
import com.founder.bm.entity.EnrollInfTo;	

public class EnrollInfDaoImpl extends BaseDaoImpl implements IEnrollInfDao {
	/** 
	 * @inheritDoc
	 * @see com.founder.bm.dao.IEnrollInfDao
	 *      #searchEnrollInfList(java.util.Map)
	 */
	public List<EnrollInfTo> searchEnrollInfList(
			Map<String, Object> paramMap) {
		return this.queryForList("enrollInf.searchEnrollInf", paramMap);
	}

	/** 
	 * @inheritDoc
	 * @see com.founder.bm.dao.IEnrollInfDao
	 *      #searchEnrollInfPagination(java.util.Map, int, int)
	 */
	public List<EnrollInfTo> searchEnrollInfPagination(
			Map<String, Object> paramMap, int startRow, int endRow) {
		return this.queryForListPagination("enrollInf.searchEnrollInf",
				paramMap, startRow, endRow);
	}
	
	/** 
	 * @inheritDoc
	 * @see com.founder.bm.dao.IEnrollInfDao
	 *      #getEnrollInfCount(java.util.Map)
	 */
	public Integer getEnrollInfCount(Map<String, Object> paramMap) {
		return (Integer) this.queryForObject("enrollInf.getEnrollInfCount", paramMap);
	}
	
	
	/** 
	 * @inheritDoc
	 * @see com.founder.bm.dao.IEnrollInfDao
	 *      #getEnrollInfByPrimaryKey(String)
	 */
	public EnrollInfTo getEnrollInfByPrimaryKey(String userId) {
		return (EnrollInfTo) queryForObject("enrollInf.getEnrollInfByPrimaryKey", userId);
	}
	

	/** 
	 * @inheritDoc
	 * @see com.founder.bm.dao.IEnrollInfDao
	 *      #insertEnrollInf(com.founder.bm.entity.EnrollInfTo)
	 */
	public Object insertEnrollInf(EnrollInfTo enrollInf) {
		return this.create("enrollInf.insertEnrollInf", enrollInf);		
	}

	/** 
	 * @inheritDoc
	 * @see com.founder.bm.dao.IEnrollInfDao
	 *      #updateEnrollInfByBean(com.founder.bm.entity.EnrollInfTo)
	 */
	public int updateEnrollInfByBean(EnrollInfTo enrollInf) {
		return this.update("enrollInf.updateEnrollInf.byBean", enrollInf);
	}

	/** 
	 * @inheritDoc
	 * @see com.founder.bm.dao.IEnrollInfDao
	 *      #updateEnrollInfByProperty(java.util.Map)
	 */
	public int updateEnrollInfByProperty(Map<String, Object> paramMap) {
		return this.update("enrollInf.updateEnrollInf.byProperty", paramMap);
	}

	
	/** 
	 * @inheritDoc
	 * @see com.founder.bm.dao.IEnrollInfDao
	 *      #deleteEnrollInfByPrimaryKey(String)
	 */
	public int deleteEnrollInfByPrimaryKey(String userId) {
		return this.delete("enrollInf.deleteEnrollInfByPrimaryKey", userId);
	}
	
	/** 
	 * @inheritDoc
	 * @see com.founder.bm.dao.IEnrollInfDao
	 *      #deleteEnrollInfBatch(String[])
	 */
	public void deleteEnrollInfBatch(String[] keyArray) {
		SqlMapClient sqlMap = this.getSqlMapClient();
		try {
			sqlMap.startBatch();
			for (String key : keyArray) {
				sqlMap.delete("enrollInf.deleteEnrollInfByPrimaryKey",
						key);
			}
			sqlMap.executeBatch();
		} catch (SQLException e) {
			e.printStackTrace();
		}
	}
		
}	
	
